package com.zx.yixun.util

import android.text.TextUtils
import com.blankj.utilcode.util.SPUtils
import com.google.gson.Gson
import com.zx.ymy.base.Constant

object DataStoreUtil {

    private val sp = SPUtils.getInstance(Constant.SPName)
    private const val TOKEN_KEY = "token"
    private const val SCREEN_TYPE = "sreentype"
    private const val SCREEN_NAME = "sreenname"
    private const val SCREEN_ID = "sreenid"
    private const val PEOPLESET = "peopleset"

    fun saveToken(token: String?) {
        sp.put(TOKEN_KEY, token)
    }

    fun getToken(): String? {
        return sp.getString(TOKEN_KEY)
    }

    fun savePeopleSet(set: Boolean) {
        sp.put(PEOPLESET, set)
    }

    fun getIsPeopleSet(): Boolean {
        return sp.getBoolean(PEOPLESET,false)
    }

    fun hasToken(): Boolean {
        return !TextUtils.isEmpty(getToken())
    }

    fun getScreenType():Int{
        return sp.getInt(SCREEN_TYPE,0)
    }

    fun saveScreenType(type:Int){
        sp.put(SCREEN_TYPE,type)   //1线头屏  2人工屏
    }

    fun getScreenName():String{
        return sp.getString(SCREEN_NAME)
    }

    fun saveScreenName(name:String?){
        sp.put(SCREEN_NAME,name)
    }
    fun getScreenId():String{
        return sp.getString(SCREEN_ID)
    }

    fun saveScreenId(id:String?){
        sp.put(SCREEN_ID,id)
    }
}

























